package com.yf.course.modules.course.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.yf.course.modules.course.dto.request.CourseVideoReqDTO;
import lombok.Data;

/**
 * <p>
 * 课程视频实体类
 * </p>
 */
@Data
@TableName("el_video")
public class Video extends Model<Video> {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 视频地址
     */
    @TableField("file_url")
    private String fileUrl;

    /**
     * 数字人声音
     */
    private String voice;

    /**
     * 数字人外观
     */
    private String appearance;

    /**
     * 视频时长
     */
    private String duration;

    public Video() {
    }

    public Video(CourseVideoReqDTO courseVideoReqDTO) {
        this.fileUrl = courseVideoReqDTO.getFileUrl();
        this.voice = courseVideoReqDTO.getVoice();
        this.appearance = courseVideoReqDTO.getAppearance();
        this.duration = courseVideoReqDTO.getDuration();
        if (courseVideoReqDTO.getVideoId() != null) {
            this.id = courseVideoReqDTO.getVideoId();
        }
    }

    @TableField(exist = false)
    private String courseId;
}
